from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import Weblog, Entry

class WeblogAdmin(admin.ModelAdmin):
	fieldsets = (
	    (None, {'fields': ('site', 'name', 'slug', 'description', 
	    	'users',)}),)
	list_display = ('name', 'slug', 'site',)
	search_fields = ['name']
	prepopulated_fields = {'slug': ('name',)}
	
class EntryAdmin(admin.ModelAdmin):
	fieldsets = (
	    (None, {'fields': ('weblog', 'user', 'title', 'slug', 'body',)}),
		(_(u'Tagging'), {'fields': ('tags',),}),
	    (_(u'Date information'), {'fields': ('pub_date',), 'classes': 'collapse'}),
        (_(u'Attachments'), {'fields': ('lead_image',)}),
        (_(u'Settings'), {'fields': ('enable_comments', 'publication_status',)}),)
	list_display = ('title', 'pub_date', 'user', 'enable_comments', 'publication_status', 'weblog',)
	list_filter = ('pub_date', 'user', 'enable_comments', 'publication_status',)
	search_fields = ['title']
	date_hierarchy = 'pub_date'
	prepopulated_fields = {'slug': ('title',)}
	radio_fields = {'publication_status': True}

admin.site.register (Weblog, WeblogAdmin)
admin.site.register (Entry, EntryAdmin)